<template>
	<view style="width: 100%;">
		<uni-forms class="loginContainer" :modelValue="user">
			<h3 class="loginTitle">系统登入</h3>
			<uni-forms-item label="用户名：">
				<uni-easyinput type="text" v-model="user.username"></uni-easyinput>
			</uni-forms-item>
			<uni-forms-item label="密码：">
				<uni-easyinput type="password" v-model="user.password"></uni-easyinput>
			</uni-forms-item>
			<button type="primary" @click="login">登录</button>
		</uni-forms>

		<view class="rigth">
			<rencalendar></rencalendar>
			<view style="background-color: #2b4b6b;">公告</view>
			<view style="height: 120px; width: 100%; border: solid 1px; background-color: #F8F9FA;"></view>
			<view style="background-color: #2b4b6b;">公司规定</view>
			<view style="height: 120px; width: 100%; border: solid 1px; background-color: #F8F9FA;"></view>
			<view style="background-color: #2b4b6b;">其他</view>
			<view style="height: 120px; width: 100%; border: solid 1px; background-color: #F8F9FA;"></view>
		</view>
	</view>
</template>

<script>
	import rencalendar from "@/components/ren-calendar/ren-calendar.vue";
	export default {
		components: {
			rencalendar,
		},
		methods: {
			login() {
				uni.request({
					url: this.api.login,
					method: "POST",
					data: this.user,
					header: {
						"Content-Type": "application/x-www-form-urlencoded"
					},
					success: res => {
						if (res.data.code) {
							uni.navigateTo({
								url: '../ProductGoods/ProductGoods',
								success: res2 => {
									uni.setStorage({
										key:"user",
										data:{
											name:res.data.obj,
											status:1
										}
									})
								}
							});
						}
					}
				})
			}
		},
		data() {
			return {
				user: {
					username: "",
					password: ""
				}
			}
		}
	}
</script>

<style>
	.loginTitle {
		margin: 0px auto 40px auto;
		text-align: center;
	}

	.loginContainer {
		border-radius: 15px;
		background-clip: padding-box;
		float: left;
		margin-left: 20%;
		margin-top: 10%;
		width: 350px;
		padding: 15px 35px 15px 35px;
		background: white;
		border: 1px solid gainsboro;
		box-shadow: 0 0 25px gray;
	}

	.left {
		border: 1px solid;
		background-color: #2b4b6b;
		height: 720px;
		/* width: 10%;  */
		float: left;
	}

	.rigth {
		border: 1px solid;
		background-color: #2b4b6b;
		/* margin-bottom: 1000px; */
		/* height: 720px; */
		width: 28%;
		float: right;
	}

	.rec {
		float: left;
		width: 45%;
		/* height: 100%; */

	}

	.alnut {
		margin: 0 10%;
		margin-top: 5%;
		/* width: 45%; */
		height: 300px;
		border: 1px solid;
		text-align: center;
		font-size: 16px;
	}

	.long {
		color: #fff;
		padding: 20px;
		font-size: 24px;
	}

	.top {
		width: 100%;
		height: 10%;
		border-bottom: 1px solid;
		background-color: #2b4b6b;
	}

	.text {
		float: left;
	}

	input {
		float: left;
		width: 120px;
		border: 1px solid;
	}

	.padd {
		/* display: flex; */
		flex-direction: column;
		align-items: center;
		margin-top: 10px;
		margin-left: 30%;
	}

	.paddbutton {
		width: 90px;

	}

	.recboutton {
		margin-top: 40px;
		/* margin-right: 10px; */
	}

	.passwd {
		margin-right: 10px;
	}
</style>
